package com.ruoyi.system.mapper;

import com.ruoyi.system.domain.Message;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * ClassName: MsgMapper <br/>
 * Description: <br/>
 * date: 2020/3/24 15:02<br/>
 *
 * @author Hesion<br />
 * @since JDK 1.8
 */
@Mapper
public interface MsgMapper {
    @Insert("INSERT INTO message(`desc`,create_time,create_by,update_time,update_by,del_flag) VALUES(#{desc},#{createTime},#{createBy},#{updateTime},#{updateBy},'0')")
    Integer doPublish(Message msg);

    @Delete("DELETE FROM message WHERE id =#{id}")
    Integer remove(String id);

    @Select("SELECT * FROM message  where del_flag = '0'")
    @Results(id = "MsgManageResult",
            value = {
                    @Result(property = "createTime", column = "create_time"),
                    @Result(property = "updateTime", column = "update_time"),
                    @Result(property = "updateBy", column = "update_by"),
                    @Result(property = "createBy", column = "create_by"),
            })
    List<Message> selectMsgList(Message message);
}
